<?php
namespace Home\Model;
use Think\Model;
class QuestionModel extends Model {

    protected $_validate = [
       // array('content','require','内容必须！'),
       array('content','checkContent','长度必须大于10个字符',1,'callback'), 
    ] ;

    protected $_auto = [
         ['status',0] ,// 新增提问的时候状态设置为1
         ['time','getTime',3,'callback'] // 自动获取当前提问时间并设置到time字段
    ] ;

    protected function getTime(){
            return date('Y-m-d H:i:s');
    }

    protected function checkContent($content){
        return strlen($content) > 10;
    }

    ///
    public function onDelete($id){
        //return false ;
        
    }
}